﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" CodeBehind="AddIPtoCall.aspx.cs" Inherits="Amkeni_System.CO.Edit.AddIPtoCall" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableDelete="True" EnableFlattening="False" 
        EnableInsert="True" EnableUpdate="True" EntitySetName="RFPs">
    </asp:EntityDataSource>

    <asp:EntityDataSource ID="IPDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" 
        EntitySetName="implementing_partner" Select="it.[ip_id], it.[abbreviation]">
    </asp:EntityDataSource>

    <asp:EntityDataSource ID="CallDataSource" runat="server" ConnectionString="name=Amkeni_DatabaseEntities" 
        DefaultContainerName="Amkeni_DatabaseEntities" EnableFlattening="False" EntitySetName="RFPs" 
        Select="it.[RFP_id], it.[RFP_name]">
    </asp:EntityDataSource>

     <div style="height:2em;">
        <div style="float:left;">
            <asp:Label ID="ContextLabel" runat="server" Text="ADD AN EXISTING IMPLEMENTING PARTNER TO AN EXISTING CALL" CssClass="ContentHead"></asp:Label>
        </div>
    </div>

    <asp:Table ID="Table1" runat="server">
        <asp:TableRow>
            <asp:TableCell style="padding-top:1em;">
                <asp:Label ID="Label4" runat="server" Text="Call"></asp:Label>
            </asp:TableCell>
            <asp:TableCell style="padding-top:1em;">
                <asp:DropDownList ID="CallList" runat="server" DataSourceID="CallDataSource" 
                    DataTextField="RFP_name" DataValueField="RFP_id"></asp:DropDownList>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell style="padding-top:1em;">
                <asp:Label ID="Label3" runat="server" Text="Implementing Partner"></asp:Label>
            </asp:TableCell>
            <asp:TableCell style="padding-top:1em;">
                <asp:DropDownList ID="IPList" runat="server" DataSourceID="IPDataSource" 
                    DataTextField="abbreviation" DataValueField="ip_id"></asp:DropDownList>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell></asp:TableCell>
            <asp:TableCell style="padding-top:1em;">
                <asp:Button ID="SaveBtn" runat="server" Text="Save" OnClick="SaveBtn_Click"/>
                &nbsp;&nbsp
                <asp:Button ID="CancelBtn" runat="server" Text="Cancel" OnClick="CancelBtn_Click" />
            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>

    <br /><br />
    <asp:Label ID="Error" runat="server" ForeColor="Red" Visible="false"></asp:Label>

    <asp:Accordion ID="Accordion1" runat="server" SelectedIndex="-1" AutoSize="None"
        FadeTransitions="true" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" 
     ContentCssClass="accordionContent" RequireOpenedPane="false" 
     SuppressHeaderPostbacks="true" OnItemDataBound="Accordion1_ItemDataBound" DataSourceID="EntityDataSource1">
        <HeaderTemplate >
            <%# DataBinder.Eval(Container.DataItem, "RFP_name") %>
        </HeaderTemplate>
        <ContentTemplate>
            <asp:Label ID="proj_label" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "RFP_id") %>'></asp:Label>
            <% if (User.IsInRole("Administrator"))
            { %>
            <asp:GridView ID="ProjectGridView" runat="server" AutoGenerateColumns="False" CssClass="NewGrid" 
                DataKeyNames="ip_id, RFP_id" 
                OnRowEditing="ProjectGridView_RowEditing" OnRowUpdating="ProjectGridView_RowUpdating" 
                OnRowCancelingEdit="ProjectGridView_RowCancelingEdit" OnRowDeleting="ProjectGridView_RowDeleting">
             <AlternatingRowStyle CssClass="NewGridAlt" />
                 <Columns>
                     <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ShowHeader="False" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxProject" runat="server" Width="30em" Text='<%# Bind("name") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="ABBREVIATION" ShowHeader="false" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxAbbreviation" runat="server" Width="10em" Text='<%# Bind("abbreviation") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label2" runat="server" Text='<%# Bind("abbreviation") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                    <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />
                 </Columns>
             </asp:GridView>
            <% }
            else
            { %>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="NewGrid" 
            DataKeyNames="ip_id, RFP_id" 
            OnRowEditing="ProjectGridView_RowEditing" OnRowUpdating="ProjectGridView_RowUpdating" 
            OnRowCancelingEdit="ProjectGridView_RowCancelingEdit" OnRowDeleting="ProjectGridView_RowDeleting">
             <AlternatingRowStyle CssClass="NewGridAlt" />
                 <Columns>
                     <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ShowHeader="False" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxProject" runat="server" Width="30em" Text='<%# Bind("name") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="ABBREVIATION" ShowHeader="false" ItemStyle-HorizontalAlign="Left">
                         <EditItemTemplate>
                             <asp:TextBox ID="TxAbbreviation" runat="server" Width="10em" Text='<%# Bind("abbreviation") %>'></asp:TextBox>
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:Label ID="Label2" runat="server" Text='<%# Bind("abbreviation") %>'></asp:Label>
                         </ItemTemplate>
                     </asp:TemplateField>
                 </Columns>
             </asp:GridView>
            <% } %>
        </ContentTemplate>
    </asp:Accordion>

</asp:Content>
